<script setup>
import { ref } from 'vue'

const msg = ref('你笑起来真好看')

// const props = defineProps(['myname', 'age'])
const props = defineProps({
    myname: String,
    age: [String, Number],
    sex: {
        type: String,
        required: true
    },
    // Number 类型的默认值
    propD: {
        type: Number,
        default: 100
    },
})


// 接收附件传递的事件
const emit = defineEmits(['getCell'])

// 点击的时候给父组件传递值
function btnClick() {
    // this.$emit()
    emit('getCell', msg)
}
</script>
<template>
    <h1>子组件 -- {{ props.myname }} -- {{ props.age }} </h1>

    <button @click="btnClick">点击传给父</button>
</template>